{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "71ca286f",
   "metadata": {},
   "source": [
    "### 周末笔记总结"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e683107c",
   "metadata": {},
   "source": [
    "#### 1.变量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "b19d5208",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Zhichao Zhichao\n",
      "What is the value of name2 now?\n"
     ]
    }
   ],
   "source": [
    "name = \"Zhichao\"\n",
    "\n",
    "name2 = name\n",
    "print(name,name2)\n",
    "\n",
    "name = \"Han-Teng\"\n",
    "\n",
    "print(\"What is the value of name2 now?\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2adfc944",
   "metadata": {},
   "source": [
    "#### 2.datetime模块和time模块（注意区分！！！！它们不同）"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "730b6975",
   "metadata": {},
   "source": [
    "time模块："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "f1dd0999",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2021-10-07 00:56:36\n",
      "Thu Oct 07 00:56:36 2021\n",
      "1459175064.0\n"
     ]
    }
   ],
   "source": [
    "import time\n",
    "\n",
    "# 格式化成2016-03-20 11:45:39形式\n",
    "print (time.strftime(\"%Y-%m-%d %H:%M:%S\", time.localtime()))\n",
    "\n",
    "# 格式化成Sat Mar 28 22:24:24 2016形式\n",
    "print (time.strftime(\"%a %b %d %H:%M:%S %Y\", time.localtime()))\n",
    " \n",
    "# 将格式字符串转换为时间戳\n",
    "a = \"Sat Mar 28 22:24:24 2016\"\n",
    "print (time.mktime(time.strptime(a,\"%a %b %d %H:%M:%S %Y\")))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ae959677",
   "metadata": {},
   "source": [
    "##### 这个就可以弄个简单的日期啦：D"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a534b778",
   "metadata": {},
   "source": [
    "#### 3.从奇数中选择对应的时间节点"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "a2ee7b0d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Not an odd minute.\n"
     ]
    }
   ],
   "source": [
    "from datetime import datetime\n",
    "\n",
    "odds = [  1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59]\n",
    "\n",
    "right_this_minute = datetime.today().minute\n",
    "\n",
    "if right_this_minute in odds:\n",
    "    print(\"This minute seems a little odd.\")\n",
    "else:\n",
    "    print(\"Not an odd minute.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "062b67ae",
   "metadata": {},
   "source": [
    "p18的循环练习："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "a8f4c2d3",
   "metadata": {},
   "outputs": [
    {
     "ename": "IndentationError",
     "evalue": "unexpected indent (<ipython-input-15-a53fa0b1bb41>, line 2)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  File \u001b[1;32m\"<ipython-input-15-a53fa0b1bb41>\"\u001b[1;36m, line \u001b[1;32m2\u001b[0m\n\u001b[1;33m    while True:\u001b[0m\n\u001b[1;37m    ^\u001b[0m\n\u001b[1;31mIndentationError\u001b[0m\u001b[1;31m:\u001b[0m unexpected indent\n"
     ]
    }
   ],
   "source": [
    "choose = \"Y\"\n",
    "            while True:\n",
    "                count -= 1\n",
    "                userchoose = input(\"继续查询具体某星期的课程Y/N\")\n",
    "                if userchoose == choose:\n",
    "                    a = input(\"请输入想要查询的星期（注意：请输入纯数字）：\")\n",
    "                    b = \"1\"\n",
    "                    c = \"2\"\n",
    "                    d = \"3\"\n",
    "                    e = \"4\"\n",
    "                    f = \"5\"\n",
    "                    g = \"6\"\n",
    "                    h = \"7\"\n",
    "                    if a == b:\n",
    "                        print(\"早上无课\")\n",
    "                        print(\"下午14：30-16：50||1-401||创业基础实践 \")\n",
    "                        print(\"晚上无课\")\n",
    "                        print(\"您还有\", count, \"次查询机会\")\n",
    "                    elif a == c:\n",
    "                        print(\"早上8：00-9：30||西体西面||传统体育养生\")\n",
    "                        print(\"早上10：35-12：00||7-402||毛概实践\")\n",
    "                        print(\"下午14：30-16：50||3-304||网站建设与运营\")\n",
    "                        print(\"晚上18：45-20：10||2-106||摄影作品鉴赏\")\n",
    "                        print(\"您还有\", count, \"次查询机会\")\n",
    "                    elif a == d:\n",
    "                        print(\"早上9：45-12：00||9-201||毛概理论\")\n",
    "                        print(\"下午公休\")\n",
    "                        print(\"晚上18：45-20：10||10-305||大英\")\n",
    "                        print(\"您还有\", count, \"次查询机会\")\n",
    "                    elif a == e:\n",
    "                        print(\"早上9：45-12：00||综合612||python\")\n",
    "                        print(\"下午16：10-18：35||11-101||科学发展史\")\n",
    "                        print(\"晚上无课\")\n",
    "                        print(\"您还有\", count, \"次查询机会\")\n",
    "                    elif a == f:\n",
    "                        print(\"早上8：00-9：30||新综612||ai\")\n",
    "                        print(\"早上10：35-12：00||10-305||大英\")\n",
    "                        print(\"下午无课\")\n",
    "                        print(\"晚上无课\")\n",
    "                        print(\"您还有\", count, \"次查询机会\")\n",
    "                    elif a == g:\n",
    "                        print(\"傻逼，没课啊\")\n",
    "                        print(\"您还有\", count, \"次查询机会\")\n",
    "                    elif a == h:\n",
    "                        print(\"傻逼，没课啊\")\n",
    "                        print(\"您还有\", count, \"次查询机会\")\n",
    "                if count == 0:\n",
    "                    print(\"您当日可查询次数已到达上限，请明天再来查询\")\n",
    "                    break\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "04abfd23",
   "metadata": {},
   "source": [
    "(我个人认为我已经在最新作业里面领悟到了循环语句的美妙之处了)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4477ff41",
   "metadata": {},
   "source": [
    "#### for 循环 内置函数range()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "7900e1d6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n",
      "2\n",
      "3\n"
     ]
    }
   ],
   "source": [
    "for i in [1,2,3]:\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a929e746",
   "metadata": {},
   "source": [
    "###### 指定次数的循环"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "43e60bb3",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "喵喵喵!\n",
      "喵喵喵!\n",
      "喵喵喵!\n",
      "喵喵喵!\n",
      "喵喵喵!\n"
     ]
    }
   ],
   "source": [
    "for num in range(5):\n",
    "    print('喵喵喵!')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f6cbf53d",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
